export const columns = context => {
  return [
    {
      prop: 'name',
      label: '岗位名称',
      minWidth: 120
    },
    {
      prop: 'updateTime',
      label: '更新时间',
      minWidth: 100
    },
    {
      label: '岗位状态',
      minWidth: 120,
      toolTip: false,
      render: (h, row) => {
        return [
          <zm-switch
            value={row.status}
            active-value="1"
            inactive-value="2"
            onChange={() => context.onSwitch(row)}
          />
        ]
      }
    },
    {
      label: '操作',
      width: 160,
      fixed: 'right',
      render: (h, row) => {
        return [
          <el-button type="text" onClick={() => context.onEdit(row)}>
            编辑
          </el-button>,
          <el-button type="text" onClick={() => context.onDetail(row)}>
            详情
          </el-button>,
          <el-button
            type="text"
            class="text-error"
            onClick={() => context.onDelete(row)}
          >
            删除
          </el-button>
        ]
      }
    }
  ]
}

export const formRule = {
  name: [
    {
      required: true,
      message: '请输入岗位名称',
      trigger: 'blur'
    }
  ],
  dateAuth: [
    {
      required: true,
      message: '请选择数据权限',
      trigger: 'blur'
    }
  ],
  companyId: [
    {
      required: true,
      message: '请选择所属公司',
      trigger: 'blur'
    }
  ],
  dateApartmentId: [
    {
      required: true,
      message: '请选择指定部门',
      trigger: 'blur'
    }
  ],
  menuIds: [
    {
      required: true,
      message: '请选择菜单权限',
      trigger: 'blur'
    }
  ]
}
